package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteSkuStockService;
import com.spzx.product.api.vo.SkuLockVo;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * @author XC
 * @version 1.0
 * {@code @date} 2025/3/21 11:20
 * @description
 * @knowledge
 */
public class RemoteSkuStockFallbackFactory implements FallbackFactory<RemoteSkuStockService> {
    @Override
    public RemoteSkuStockService create(Throwable cause) {

        return new RemoteSkuStockService() {
            @Override
            public R<String> checkAndLock(String orderNo, List<SkuLockVo> skuLockVoList, String source) {

                return R.fail("检查与锁定商品失败：" + cause.getMessage());
            }
        };
    }
}
